import React, { Component } from 'react';
import {EditForm} from './EditForm';
import { Row, Col, message,Input, Icon,Form, Cascader, DatePicker, Button, Tooltip, Popconfirm } from 'antd';


class FormContainr extends Component{
    constructor(props){
        super(props);
        this.state = {
            Value: null,
            viewHistory: false,
            objectEdting: false,
            tableData: [],
            searchDate: [],
            afterSeachData: [],
            currentControlData: [],
            historyData: null,
        };
    }


    /*编辑对象  */
    EditObject() {
        let self = this;
        self.setState({objectEdting: true});
    }


    /**
     * 复制对象
     */
    CopyObject() {
        let self = this;
        let objData=self.state.objectInfo;
        objData.vId=0;
        self.setState({objectEdting: true,objectInfo:objData});
    }

   /*取消对象编辑之后的操作：将对象的编辑状态改成只读*/
   closeEvent() {
    let self = this;
    self.setState({objectEdting: false});
    }

    render(){
        let self =this;
        let edit = false ;
        let objectInfo ={
            beginDate:new Date(),
            dateRangeBeforeEdit:{beginDate:new Date(),endDate:'9999-12-31'},
            endDate:'9999-12-31',
            nn :'ceshi',
            adr :'lxhy',
            sx : 'man',
            objectID:{id:'Org0000000005',type:'O'}
        };



        return (<div>
            <EditForm ref="ObjInfo" 
             onEdit={self.EditObject.bind(self)}
             onCopy={self.CopyObject.bind(self)}
             closeEvent={self.closeEvent.bind(self)}
            data={objectInfo} 
            isNew={false} 
            editing={self.state.objectEdting}
            />
        </div>)

    }
}

FormContainr = Form.create()(FormContainr);
export {
    FormContainr as FormContainr
}